

const http = require("http")
const port = 3500
const host = "0.0.0.0"
const word = require('./demo') //模块引入
const {a,msg,list} = require('./many')
const User =require('./User')
const Student =require('./Student')

const u1 = new User("胡桃",16,["七七","香菱","行秋","重云"])
const s1 = new Student("刻晴",22,["凝光","甘雨"],"天街巡游")

const server = http.createServer((req,res)=>{
    if(req.url!="/favicon.ico"){
    console.log(req.url)
    res.writeHead(200,{'content-type':'text/html;charset=utf8'})
    res.write("<h2>芜湖~起飞!</h2>")
    res.write("<h2>node的简单模块化</h2>")
    res.write(`${word}`)
    res.write(`<h2>${a}</h2>`)
    res.write(`<h2>${msg}</h2>`)
    res.write(`<h2>${list}</h2>`)
    res.write(`<h2>${u1.name} -- ${u1.age} -- ${u1.friend} -- ${u1.say()} -- ${User.hobby}</h2>`)

    res.write(`<h2>${s1.name} -- ${s1.age} -- ${s1.friend} -- ${s1.say()} -- ${Student.hobby} -- ${s1.skill}</h2>`)


    res.end()
    }
}).listen(port,host,()=>{
    console.log("node server is running! at" + port)
})

